<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8' />
    <title></title>
    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
    <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.32.1/mapbox-gl.js'></script>
    <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.32.1/mapbox-gl.css' rel='stylesheet' />
    <style>
        body { margin:0; padding:0; }
        #map { position:absolute; top:0; bottom:0; width:100%; }
    </style>
</head>
<body>

<style>
body {
    overflow: hidden;
}

body * {
   -webkit-touch-callout: none;
     -webkit-user-select: none;
        -moz-user-select: none;
         -ms-user-select: none;
             user-select: none;
}

.map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
}
</style>
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-compare/v0.1.0/mapbox-gl-compare.css' type='text/css' />

<div id='before' class='map'></div>
<div id='after' class='map'></div>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoiYWVyaXNwYWhhIiwiYSI6ImNpdWp3ZTUwbDAxMHoyeXNjdDlmcG0zbDcifQ.mjQG7vHfOacyFDzMgxawzw';
var beforeMap = new mapboxgl.Map({
    container: 'before',
    style: 'mapbox://styles/mapbox/dark-v9',
    center: [-75.148946, 39.921685],
    zoom: 0
});

var afterMap = new mapboxgl.Map({
    container: 'after',
    style: 'mapbox://styles/mapbox/dark-v9',
    center: [-75.148946, 39.921685],
    zoom: 0
});

var map = new mapboxgl.Compare(beforeMap, afterMap, {
    // Set this to enable comparing two maps by mouse movement:
    // mousemove: true
    center: [-75.148946, 39.921685],
});

//INSERT GEOJSON HERE ~~~~~

afterMap.on('load', function() {
  //load the data into the map
  afterMap.addSource('sewer-data', {'type': 'geojson', 'data': conduits});
  afterMap.addSource('parcel-data', {'type': 'geojson','data': parcels});
  afterMap.addLayer({
      "id": "parcel-extrusion-proposed",
      'type': 'fill-extrusion',
      "source": "parcel-data",
      'paint': {
          'fill-extrusion-color': {
              property: 'HoursFloodedProposed',
              stops: [
                [0.0833, '#343332'],
                [2.0, '#f91313']
              ]
            },
            'fill-extrusion-height': {
                property: 'HoursFloodedProposed',
                stops: [
                  [0.0833, 5],
                  [2.0, 200]
                ]
            },

          'fill-extrusion-opacity': 0.8,
      }
  });

});

beforeMap.on('load', function() {

  //load the data into the map
  beforeMap.addSource('sewer-data', {'type': 'geojson', 'data': conduits});
  beforeMap.addSource('parcel-data', {'type': 'geojson','data': parcels});

  beforeMap.addLayer({
      "id": "parcel-extrusion-baseline",
      'type': 'fill-extrusion',
      "source": "parcel-data",
      'paint': {
          'fill-extrusion-color': {
              property: 'HoursFloodedBaseline',
              stops: [
                [0.0833, '#343332'],
                [2.0, '#f91313']
              ]
            },
            'fill-extrusion-height': {
                property: 'HoursFloodedBaseline',
                stops: [
                  [0.0833, 5],
                  [2.0, 200]
                ]
            },

          'fill-extrusion-opacity': 0.8,
      }
	});

});



</script>

</body>
</html>
